<?php
session_start();
if(!isset($_SESSION['admin'])){
    header("location: login.php");
    exit;
}
require_once 'PmsDb.php';
$pmsDb = new PmsDb('fdn');
function getOrders() {
	try {
		global $pmsDb;
		$sql = "select * from t_fdn_order order by id desc";
		$result = $pmsDb->pdo->query ( $sql );
        $rs = $result->fetchAll();
	    return $rs;
	} catch ( PDOException $e ) {
        echo $e->getMessage();
		return false;
	}
}
$orders = getOrders();
?>
<!DOCTYPE html>
<!-- saved from url=(0032)http://web.ikeepfit.cn/payAnswer -->
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta http-equiv="expires" content="0">
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta name="format-detection" content="telephone=no">
<meta name="HandheldFriendly" content="true" />
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style"
	content="black-translucent">
<meta name="viewport"
	content="width=device-width, initial-scale=1 maximum-scale=1 user-scalable=0, minimal-ui" />
<meta http-equiv="Cache-Control" content="private">
<meta http-equiv="expires" content="43200">
<link rel='stylesheet' href='http://web.ikeepfit.cn/css/style.css' />
<link rel='stylesheet' href='http://web.ikeepfit.cn/css/style_add.css' />
<script src="http://cdn.bootcss.com/jquery/2.1.1/jquery.min.js"></script>
<title>订单</title>
</head>

<body>
	<style>
.quest-weixin ul li .p {
	overflow: auto;
	padding: 0;
}

.quest-weixin ul li .p span {
	float: left;
	width: 33%;
	background: none;
	padding: 0;
}

.quest-weixin ul li .p span img {
	display: block;
	opacity: 0.6;
	width: 80px;
	height: 110px;
	display: block;
	margin: auto;
	border: 4px solid #fff;
	border-radius: 3px;
}

.quest-weixin ul li .p .span {
	background: none;
}

.quest-weixin ul li .p .span img {
	border: 4px solid #188747;
	opacity: 1;
}
</style>

	<div class="quest-weixin">
        <div class="submit" > <a style=" display: block; width: 100%; height: 100%; " href="order.php">添加</a> </div>
        <table style="width:100%;">
            <tr>
                <td>订单编号</td>
                <td>手机</td>
                <td>套餐</td>
                <td>状态</td>
                <td>备注</td>
                <td>更新时间</td>
                <td>创建时间</td>
            </tr>
<?php 
$orderMap = array(
"YD_6855d4bf9e614a30b1e39b1fd357a0fe"=>"@移动-10M@",
"YD_eb2f0ca73f5f4e658cf97668d47d3b0f"=>"@移动-30M@",
"YD_7c420dfaced647e68a12c7047edc3c70"=>"@移动-70M@",
"YD_fbf77c7d46194eadab11063d805285ee"=>"@移动-150M@",
"YD_9a0538e9b30440b89f27e0757b635674"=>"@移动-500M@",
"YD_adaf1dd5a37e4e4399deda46ed28fb40"=>"@移动-1G@",
"LT_0e3c57f43ef14c258bc45afbfccc0af9"=>"@联通-20M@",
"LT_cd101c599a704a9ebfb715a7fc1766b1"=>"@联通-50M@",
"LT_cbaf431090224cd18703f97df902980e"=>"@联通-100M@",
"LT_e1e0dcdad112471b85ae2402f8987a5b"=>"@联通-200M@",
"LT_4c7342336a5d493b8e53121408fdf7ed"=>"@联通-500M@",
"DX_098e4e11b87545d39aec76e5ee9b6e3c"=>"@电信-5M@",
"DX_d74a4daaf0744371a692f63f42b844ee"=>"@电信-10M@",
"DX_1a24b71fc8964d93ae3e8c397c9e2fb7"=>"@电信-30M@",
"DX_6bb7d9b1fd2d4837b012bd04ab8f3071"=>"@电信-50M@",
"DX_feb79b687a274a1195a5921f7dc0ff9c"=>"@电信-100M@",
"DX_4585ef3afcfa438fa3d787be3fcc2e78"=>"@电信-200M@",
"DX_9b76f45c115b456cb026a45083625d91"=>"@电信-500M@",
"DX_40bfd85817074ae5ba9d8c84ae7c0998"=>"@电信-1G@",
);
$statusMap = array("0"=>"充值中","1"=>"成功","2"=>"失败");

foreach($orders as $order){
    $orderId = $order['order_id'];
    $tel = $order['phone'];
    $orderName = $orderMap[$order['cp_order_no']];
    $statusName = $statusMap[$order['status']];
    $remark = $order['remark'];
    $updatedAt = $order['updated_at'];
    $createdAt = $order['created_at'];
    echo "<tr><td> $orderId </td>";
    echo "<td> $tel </td>";
    echo "<td> $orderName </td>";
    echo "<td> $statusName </td>";
    echo "<td> $remark </td>";
    echo "<td> $updatedAt </td>";
    echo "<td> $createdAt </td></tr>";
}
?>
        </table>
	</div>


</body>
<script src="http://7jpqaz.com1.z0.glb.clouddn.com/mobiscroll_002.js"
	type="text/javascript"></script>
<script src="http://7jpqaz.com1.z0.glb.clouddn.com/mobiscroll.js"
	type="text/javascript"></script>
<link href="http://7jpqaz.com1.z0.glb.clouddn.com/mobiscroll.css"
	rel="stylesheet" type="text/css">
<script src="http://7u2j7v.com1.z0.glb.clouddn.com/jquery.cookie.js"
	type="text/javascript"></script>
<script type="text/javascript"
	src="http://7xav4p.com1.z0.glb.clouddn.com/plupload.full.min.js"></script>
<script type="text/javascript"
	src="http://7xav4p.com1.z0.glb.clouddn.com/zh_CN.js"></script>
<script type="text/javascript"
	src="http://7xav4p.com1.z0.glb.clouddn.com/ui.js"></script>
<script type="text/javascript"
	src="http://7xav4p.com1.z0.glb.clouddn.com/qiniu.js"></script>

<script>

$(function(){
	$("#submit").click(function(sender) {
		var submit = $(sender.target);
		var url = "post.php";
		$.post(url, $("#editorForm").serialize(), function(data) {
			if (data.code==0) {
				alert("提交成功");
			} else {
				alert("失败");
			}
		}, "json");
	});	
});
    
</script>
</html>
